<div><b>Весь список отделов:</b>
<ul class="our_branches">
<?php foreach ($allbranches as $branch)
{ ?>
	<li><?php echo link_to($branch['title'],'branch/index?cbranch='.$branch['id'], array('class'=> ($branch['id'] == $cbranch? 'activebranch': 'inactivebranch') ));?>
	</li>
	<?php } ?>
</ul>
	<?php
	if ($cbranch!=NULL)
	{		?>
<div>
<div class='brancheader'><?php echo $currbranch['title']; ?></div>
<br />
	<?php echo $currbranch['body'];
	?></div>
<br />
<hr class='diviser'>
<div class='brancheader'>События отдела:</div>
<div><?php if(count($events)){ foreach($events as $event)
{ ?>
<div class="item">
<div class="photo">
<?php  echo link_to('<img src="/uploads/events/thumbnail_169_127/'.$event['image'].'"/>','event_view',$event); ?>
</div>
<div class="description">
<h2><?php echo $event['title'];?></h2>
<em class="date"><?php echo format_date(strtotime($event['updated_at']),'D','ru');?> <?php if (strtotime($event['updated_at'])<date(time())) echo '<strong>(событие прошло)</strong>'; ?> </em>
<p><?php echo $event['short'] ?></p>
<div class="more"><?php echo link_to('Подробнее','event_view',$event); ?>
</div>
</div>
</div>
<?php }} else
{
	echo 'У этого отдела нет новых событий.';
} ?></div>
<?php } ?></div>
